<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #box {
      width: 250px;
      height: 250px;
      margin: 100px auto;
      padding: 50px;
      border: 1px solid #000;
    }

    #word {
      width: 250px;
      height: 30px;
      font-size: 18px;
    }

    #show {
      width: 250px;
      height: 200px;
      margin-top: 20px;
      padding: 10px;
      background-color: lightgray;
      box-sizing: border-box;
    }
  </style>
  <script src="./demo.js"></script>
</head>

<body>
  <div id="box">
    <input type="text" id="word" placeholder="输入英文单词">
    <div id="show"></div>
  </div>
  <script>
    var arr = word.split("\n")
    let map = new Map()
    for (var i = 0; i < arr.length - 1; i += 2) {
      map.set(arr[i].substring(1), arr[i + 1].substring(6))
    }
    var oWord = document.getElementById("word")
    var oShow = document.getElementById("show")
    oWord.onkeyup = function () {
      var value = map.get(oWord.value)
      if (value) {
        oShow.innerHTML = value.split("@").join("<br>")
      } else {
        oShow.innerHTML = "查无此词"
      }
    }
  </script>
</body>

</html>